import Vue from 'vue'
import Router from 'vue-router'
import index from '@/components/index'
import main from '@/components/main'

Vue.use(Router)

export default new Router({
  routes: [{
    path: '/',
    name: 'index',
    component: index
  },
  {
    path: "/main",
    name: "main",
    component: main,
    children: [{
      path: '/main/kaisuo',
      name: 'kaisuo',
      component: function (resolve) {
        require(['../components/kaisuo'], resolve)
      }
    },
    {
      path: '/main/jiankong',
      name: 'jiankong',
      component: function (resolve) {
        require(['../components/jiankong'], resolve)
      }
    },
    {
      path: '/main/setting',
      name: 'setting',
      component: function (resolve) {
        require(['../components/setting'], resolve)
      }
    },
    {
      path: '/main/usermanger',
      name: 'usermanger',
      component: function (resolve) {
        require(['../components/usermanger'], resolve)
      }
    },
    {
      path: '/main/bind',
      name: 'bind',
      component: function (resolve) {
        require(['../components/bind'], resolve)
      }
    },
    {
      path: '/main/bindSuccess',
      name: 'bindSuccess',
      component: function (resolve) {
        require(['../components/bindSuccess'], resolve)
      }
    },
    {
      path: '/main/realtime_camera',
      name: 'realtime_camera',
      component: function (resolve) {
        require(['../components/realtime_camera'], resolve)
      }
    },
    {
      path: '/main/deviceInfo',
      name: 'deviceInfo',
      component: function (resolve) {
        require(['../components/deviceInfo'], resolve)
      }
    }
    ]
  }

  ]
})
